// pages/sendOrderList1/sendOrderList1.js
import tool from '../../utils/util'
var addressparse = require('../../utils/addressparse.js');
var arealist = require('../../utils/arealist.js');
Page({

  /**
   * 页面的初始数据
   */
  data: {
    showtime: false,
    loading: false,
    disabled: false,
    datetime: '',
    content: "",

    name: '',
    mobile: '',

    address: '',


    type: '',
    time: '',

    areaList: {
      province_list: {
        110000: '北京市',
        120000: '天津市'
      },
      city_list: {
        110100: '北京市',
        120100: '天津市',
      },
      county_list: {
        110101: '东城区',
        110102: '西城区',
        110105: '朝阳区',
        110106: '丰台区',
        120101: '和平区',
        120102: '河东区',
        120103: '河西区',
        120104: '南开区',
        120105: '河北区',

      }
    }
  },
  onConfirm(Object) {
    this.setData({
      detetime: tool.handeleCity(Object.detail.values).join("-"),
      showtime: false
    })
  },

  setShowtime() {
    this.setData({
      showtime: true
    });
  },
  onCancel() {
    this.setData({
      showtime: false
    });
  },
  onClose() {
    this.setData({
      showtime: false
    });
  },
  formName: function (e) {
    this.setData({
      content: e.detail.value
    })
  },
  clearContent() {
    this.setData({
      content: "",
      name: "",
      mobile: "",
      address: "",
      detetime: ""
    })
  },
  intelligence() {
    if (this.data.content) {
      var result = addressparse.parseList(this.data.content);
      this.setData({
        name: result.name,
        mobile: result.mobile,
        address: result.addr,
        detetime: result.province + "-" + result.city + "-" + result.area
      })
    }
    // 福建省福州市福清市石竹街道义明综合楼3F，15000000000，akebe
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    addressparse.parseArea(arealist.areaList); //智能粘贴初始化数据

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})